#include <stdio.h>
#include <stdlib.h>
#define e int
struct listnode {
    e data;
    struct listnode* nextptr;
};
typedef struct listnode* LISTPTR;
void create(LISTPTR* atr) {
    *atr = (LISTPTR)malloc(sizeof(struct listnode));
    if (*atr!= NULL) {
        (*atr)->nextptr = NULL;
    }
}
void insertEnd1(LISTPTR sPTR, e value) {
    LISTPTR newPTR, previousPTR, currentPTR;
    newPTR = (LISTPTR)malloc(sizeof(struct listnode));
    if (newPTR!= NULL) {
        newPTR->data = value;
        newPTR->nextptr = NULL;
        previousPTR = sPTR;
        currentPTR = sPTR->nextptr;
        while (currentPTR!= NULL) {
            previousPTR = currentPTR;
            currentPTR = currentPTR->nextptr;
        }
        previousPTR->nextptr = newPTR;
    } else {
        printf("Not inserted.\n");
    }
}
void printList(LISTPTR head) {
    LISTPTR current = head;
    while (current!= NULL) {
        printf("%d ", current->data);
        current = current->nextptr;
    }
    printf("\n");
}

int main(void) {
    LISTPTR atr = NULL;
    create(&atr);
    insertEnd1(atr, 1);
    insertEnd1(atr, 2);
    insertEnd1(atr, 3);
    printList(atr);
    return 0;
}
